Hello, |
Re: Web Request Download http://www.vbaexpress.com/kb/getarticle.php?kb_id=799 However I guess you can have a couple of problems with this, especially with chr(0) characters. We had another post here, where getting data that contained chr(0) characters failed, so as long as you are referring to text files it should be easy - binary files might be a little harder. Just post if you need a code example. Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Web Request Download Mathias Mamsch - Thu Jun 23 07:23:19 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS I would very much like to see an example. Thank you. |
Re: Web Request Download lsand - Thu Jun 23 12:23:59 EDT 2011
Here you go. You need to improve error checking and properly cleanup the ole objects. Hope it helps, regards, Mathias
OleAutoArgs args = create
void GetFile(string url) {
OleAutoObj objMsxml = oleCreateAutoObject "MSXML2.XMLHTTP"
if (null objMsxml) error "Could not create Microsoft XML Request ..."
put(args, "GET")
put(args, url)
put(args, false)
string err = ""
err = err oleMethod (objMsxml, "Open", args)
if (null err) err = oleMethod (objMsxml, "Send")
if (!null err) {
string stat = ""
print oleGet(objMsxml, "statusText", stat)
print "Could not open URL:" err
print "Status = " stat "\n"
return
}
int state = 0
while (state != 4) {
print oleGet(objMsxml, "readyState", state)
sleep_(100)
}
string s = ""
print oleGet(objMsxml, "responseText", s)
print "FILE = " s
}
GetFile "http://www.google.com/robots.txt"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Web Request Download Mathias Mamsch - Thu Jun 23 12:56:58 EDT 2011
Here you go. You need to improve error checking and properly cleanup the ole objects. Hope it helps, regards, Mathias
OleAutoArgs args = create
void GetFile(string url) {
OleAutoObj objMsxml = oleCreateAutoObject "MSXML2.XMLHTTP"
if (null objMsxml) error "Could not create Microsoft XML Request ..."
put(args, "GET")
put(args, url)
put(args, false)
string err = ""
err = err oleMethod (objMsxml, "Open", args)
if (null err) err = oleMethod (objMsxml, "Send")
if (!null err) {
string stat = ""
print oleGet(objMsxml, "statusText", stat)
print "Could not open URL:" err
print "Status = " stat "\n"
return
}
int state = 0
while (state != 4) {
print oleGet(objMsxml, "readyState", state)
sleep_(100)
}
string s = ""
print oleGet(objMsxml, "responseText", s)
print "FILE = " s
}
GetFile "http://www.google.com/robots.txt"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
thank you. |
Re: Web Request Download lsand - Thu Jun 23 16:49:24 EDT 2011 http://msdn.microsoft.com/en-us/library/ms536648%28v=vs.85%29.aspx Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |